package com.MetroMinder;


import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class mainActivity extends Activity {
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {    	
    	super.onCreate(icicle);
    	
    	setContentView(R.layout.main);
    	
    	Spinner s = (Spinner) findViewById(R.id.stationSpinner); 
        ArrayAdapter adapter = ArrayAdapter.createFromResource( 
                this, R.array.metroStationNames, android.R.layout.simple_spinner_item); 
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
        s.setAdapter(adapter);
        
        // Test
        String test = "";

    	        
    	String pageContent = "";
    	String pageUrl = getString(R.string.metro_real_time_arrivals_page) + "12"; //; 
    	
    	try
    	{
			pageContent = com.MetroMinder.Utilities.UrlHelpers.getPageContent(pageUrl);
		}
    	catch (com.MetroMinder.Utilities.UrlHelpers.ApiException e1) 
    	{
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} 
    	catch (com.MetroMinder.Utilities.UrlHelpers.ParseException e1) 
    	{
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
    	
    	String testHtml = "<html><body>Test</body><html>";
        //pageContent = pageUrl + "\n\n" + pageContent;
		
        
		WebView b = (WebView)findViewById(R.id.mainWebView);
        b.loadData(pageContent, "text/html", "UTF-8");
        //b.loadData(testHtml, "text/html", "UTF-8");
		//b.loadUrl("http://www.cnn.com/");

    }
    

    
}